package ru.ys.jsolver.model;

import java.util.List;

import ru.ys.jsolver.model.Board.LineType;

public class Line implements Comparable<Line>{
	final LineType myType;
	final int[] myTask;
	final int myTaskLength;
	
	private final int myTotalLength; 
	boolean myElementInvestigated;
	final int myIndex;
	
	Line(LineType type, List<Integer> task, int lineIndex) {
		int len = 0;
		myType = type;
		myTaskLength = task.size();
		myTask = new int[myTaskLength];
		int counter = 0;
		for (Integer i : task) {
			len += i;
			myTask[counter] = i;
			counter++;
		}
		myTotalLength = len;
		myIndex = lineIndex;
	}

	@Override
	public int compareTo(Line o) {
		if (o.myTaskLength != myTaskLength) {
			if (o.myTaskLength > myTaskLength) {
				return -1;
			} else {
				return 1;
			}
		}
		if (o.myTotalLength != myTotalLength) {
			if (o.myTotalLength > myTotalLength) {
				return 1;
			} else {
				return -1;
			}
		}
		return (o.hashCode() - hashCode());		
	}
	
	
	
	
}
